import { Tag } from 'antd';
import React, { useMemo } from 'react';

interface StatusTagProps {
    status: string;
}

const StatusTag: React.FC<StatusTagProps> = ({ status }) => {
    const tagProps = useMemo(() => {
        switch (status) {
            case 'running':
                return { color: 'green', text: '运行中' };
            case 'stopped':
                return { color: 'red', text: '已停止' };
            case 'not-found':
                return { color: 'warning', text: '未安装' };
            default:
                return { color: 'default', text: '未知' };
        }
    }, [status]);

    return <Tag color={tagProps.color}>{tagProps.text}</Tag>;
};

export default StatusTag;
